﻿<Window x:Class="WD.Shell.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="450" Width="700" MinWidth="700" MinHeight="450" Loaded="WindowLoaded">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVis" />
    </Window.Resources>
    <DockPanel Style="{DynamicResource WindowStyle}">
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="File"></MenuItem>
        </Menu>
        <Border BorderBrush="#7F7F7F" Margin="20" Padding="2.5" BorderThickness="0.75">
            <DockPanel>
                <Border x:Name="panelContainer" DockPanel.Dock="Bottom" 
                        Height="40" Margin="0,2,0,0" Style="{DynamicResource ToolPanelStyle}">
                    <StackPanel Orientation="Horizontal">
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button0Style}"></Button>
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button1Style}" ></Button>
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button2Style}"></Button>
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button3Style}"></Button>
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button_Style_line}"></Button>
                        <Button Margin="5" Width="35" Height="25" 
                                Style="{DynamicResource button_Style_polyline}"></Button>
                        <Rectangle Margin="10" Width="0.5" Fill="Black"/>
                        <Rectangle Width="0.5" Fill="Black" Margin="80,10,10,10"/>
                        <ToggleButton Margin="5" Width="40" Height="25" Click="CheckFps">FPS</ToggleButton>
                        <Button Margin="5" Width="40" Height="25" 
                                Style="{DynamicResource button_Style_ActionButtonStyle}"
                                Command="{Binding ApplyThemeCommand}" 
                                CommandParameter="Blend">Blend</Button>
                        <Button Margin="5" Width="40" Height="25" 
                                Style="{DynamicResource button_Style_ActionButtonStyle}"
                                Command="{Binding ApplyThemeCommand}" 
                                CommandParameter="Windows7" Content="Win 7"></Button>
                        <ToggleButton x:Name="btnZoomer" CommandParameter="Windows7" Content="Zoom" Height="25"  Width="40" />
                        <Rectangle Margin="10" Width="0.5" Fill="Black"/>
                    </StackPanel>
                </Border>
                <Border Style="{DynamicResource CanvasContainerStyle}">
                    <Grid>
                        <ScrollViewer Name="scrollViewer"
                                VerticalScrollBarVisibility="Auto" 
                                HorizontalScrollBarVisibility="Auto">
                            <Canvas x:Name="GraphControl" ClipToBounds="True" Background="Silver" Opacity="1" RenderTransformOrigin="0.5,0.5">
                                <Canvas.RenderTransform>
                                    <ScaleTransform
                                        CenterX="{Binding CenterX}" 
                                        CenterY="{Binding CenterY}"
                                        ScaleX="{Binding ElementName=uiScaleSlider,Path=Value}"
                                        ScaleY="{Binding ElementName=uiScaleSlider,Path=Value}"
                                    />
                                </Canvas.RenderTransform>
                            </Canvas>
                        </ScrollViewer>
                        <Slider  Value="1" Minimum="0.1" Maximum="4" Name="uiScaleSlider" Width="120" Margin="54,240,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <Slider.RenderTransform>
                                <RotateTransform  Angle="270"></RotateTransform>
                            </Slider.RenderTransform>
                        </Slider>
                        <Grid Width="90" Height="90" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20,20,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition>
                                </ColumnDefinition>
                                <ColumnDefinition>
                                </ColumnDefinition>
                                <ColumnDefinition>
                                </ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition>
                                </RowDefinition>
                                <RowDefinition>
                                </RowDefinition>
                                <RowDefinition>
                                </RowDefinition>
                            </Grid.RowDefinitions>
                            <Button Margin="4" Grid.Row="1" Command="{Binding ChangeCenter}" CommandParameter="Left">&lt;</Button>
                            <Button Margin="4" Grid.Row="1" Grid.Column="2" Command="{Binding ChangeCenter}" CommandParameter="Right">&gt;</Button>
                            <Button Margin="4" Grid.Row="0" Grid.Column="1" Command="{Binding ChangeCenter}" CommandParameter="Up">˄</Button>
                            <Button Margin="4" Grid.Row="2" Grid.Column="1" Command="{Binding ChangeCenter}" CommandParameter="Down">˅</Button>
                            <Button Margin="4" Grid.Row="1" Grid.Column="1" Command="{Binding ChangeCenter}" CommandParameter="Center">͏</Button>
                        </Grid>
                        <Canvas HorizontalAlignment="Left" VerticalAlignment="Top">
                            <Canvas Name="magnifierCanvas" IsHitTestVisible="False" Visibility="{Binding ElementName=btnZoomer,Path=IsChecked,Converter={StaticResource BoolToVis}}">
                                <Line StrokeThickness="30" X1="200" Y1="200" X2="300" Y2="300">
                                    <Line.Stroke>
                                        <LinearGradientBrush StartPoint="0.78786,1" EndPoint="1,0.78786">
                                            <GradientStop Offset="0" Color="DarkGreen" />
                                            <GradientStop Offset="0.9" Color="LightGreen" />
                                            <GradientStop Offset="1" Color="Green" />
                                        </LinearGradientBrush>
                                    </Line.Stroke>
                                </Line>
                                <Ellipse Width="250" Height="250" Fill="White" />
                                <Ellipse Width="250" Height="250" Name="magnifierEllipse" StrokeThickness="3">
                                    <Ellipse.Fill>
                                        <VisualBrush ViewboxUnits="Absolute" Viewbox="0,0,50,50" ViewportUnits="RelativeToBoundingBox" Viewport="0,0,1,1"/>
                                    </Ellipse.Fill>
                                    <Ellipse.Stroke>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Offset="0" Color="#AAA" />
                                            <GradientStop Offset="1" Color="#111" />
                                        </LinearGradientBrush>
                                    </Ellipse.Stroke>
                                </Ellipse>
                                <Ellipse Canvas.Left="2" Canvas.Top="2" StrokeThickness="4" Width="246" Height="246">
                                    <Ellipse.Stroke>
                                        <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                            <GradientStop Offset="0" Color="#555" />
                                            <GradientStop Offset="1" Color="#EEE" />
                                        </LinearGradientBrush>
                                    </Ellipse.Stroke>
                                </Ellipse>
                            </Canvas>
                        </Canvas>
                    </Grid>
                </Border>
            </DockPanel>
        </Border>
    </DockPanel>
</Window>